package com.pxxy.yuyi.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pxxy.yuyi.dao.TeachersDao;
import com.pxxy.yuyi.entity.Teachers;
import com.pxxy.yuyi.service.TeachersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by IntelliJ IDEA
 *
 * @Author : XuWen
 * @create 2021/6/19 16:56
 */
@Service
public class TeachersServiceImpl implements TeachersService {
    @Autowired
    private TeachersDao teachersDao;

    @Override
    public PageInfo<Teachers> selectTealist(Teachers teachers,Integer pageNum) {
        PageHelper.startPage(pageNum,6);
        List<Teachers> list =  teachersDao.selectTealist(teachers);
        System.out.println(teachers);
        return new PageInfo<Teachers>(list);
    }

    @Override
    public Teachers selectById(Integer tid) {
        return teachersDao.selectById(tid);
    }

    @Override
    public Integer updateTeacher(Teachers teachers) {
        Integer res=  teachersDao.updateTeacher(teachers);
        return res;
    }

    @Override
    public void deleteTeachers(Integer tid) {
        teachersDao.deleteTeachers(tid);
    }

    @Override
    public void insertTeachers(Teachers teachers) {
        teachersDao.insertTeachers(teachers);
    }

}
